//
//  MusicViewController.m
//  XMLY
//
//  Created by 曾杰 on 15/11/4.
//  Copyright © 2015年 曾杰. All rights reserved.
//

#import "MusicViewController.h"
#import "MusicViewCell.h"
#import "MusicTableViewController.h"
#import "MusicRecommendTableViewController.h"
#import "HACursor.h"
#import "UIView+Extension.h"
@interface MusicViewController ()
@property (nonatomic, strong) NSArray *items;
@property (nonatomic, strong)MusicTableViewController * musicVC;
@property (nonatomic, strong)MusicRecommendTableViewController * remmendVC;
@property (nonatomic, strong)UINavigationController * navc;
@property (nonatomic, strong)UINavigationController * navc1;
@property (nonatomic, strong)HACursor *cursor;
@property (nonatomic, strong)NSMutableArray * pageViews;
@end

@implementation MusicViewController
- (NSArray *)items {
    if (_items == nil) {
        _items = @[@"推荐", @"精选", @"独创", @"翻唱", @"主播|节目", @"排行", @"明星", @"怀旧", @"电影|原声", @"动慢|游戏",@"禅音",@"催眠",@"儿童",@"华语|粤语",@"日语韩语",@"欧美",@"器乐",@"安静",@"伤感",@"午后",@"纯音乐"];
    }
    return _items;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
       self.titleLabel.text = @"音乐";
  
    
     _cursor = [[HACursor alloc]init];
    _cursor.frame = CGRectMake(0, 64, self.view.width, 45);
    _cursor.titles = self.items;
    _cursor.pageViews = [self createPageViews];
    //设置根滚动视图的高度
    _cursor.rootScrollViewHeight = self.view.frame.size.height -109;
    //默认值是白色
    _cursor.titleNormalColor = [UIColor blackColor];
    //默认值是白色
    _cursor.titleSelectedColor = [UIColor redColor];
    //是否显示排序按钮
    _cursor.showSortbutton = NO;
    //默认的最小值是5，小于默认值的话按默认值设置
    _cursor.minFontSize = 15;
    //默认的最大值是25，小于默认值的话按默认值设置，大于默认值按设置的值处理
    _cursor.maxFontSize = 18;
    //cursor.isGraduallyChangFont = NO;
    //在isGraduallyChangFont为NO的时候，isGraduallyChangColor不会有效果
    //cursor.isGraduallyChangColor = NO;
    [self.view addSubview:_cursor];
    
    
    // Do any additional setup after loading the view.
}


-(NSMutableArray *)createPageViews
{
   _pageViews = [NSMutableArray arrayWithCapacity:0];
    _remmendVC = [[MusicRecommendTableViewController alloc]init];
   
    [_pageViews addObject:_remmendVC.view];
    

    for (int i = 1 ; i< self.items.count; i++) {
        
    _musicVC = [[MusicTableViewController alloc]init];
   
        switch (i) {
            
            case 1:
            {
                
//
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E7%B2%BE%E9%80%89%7C%E6%AD%8C%E5%8D%95";
               
                
                
            }
                break;
            case 2:
            {

                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=android&pageId=1&pageSize=20&status=0&tagName=%E5%8E%9F%E5%88%9B%7C%E7%8B%AC%E7%AB%8B";
                
            }break;
            case 3:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E7%BF%BB%E5%94%B1%7C%E7%BF%BB%E5%A5%8F";
                
                
            }
                break;
            case 4:
            {
                
               _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E4%B8%BB%E6%92%AD%7C%E8%8A%82%E7%9B%AE";
                
                
            }
                break;
                
            case 5:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E6%A6%9C%E5%8D%95%7C%E6%8E%92%E8%A1%8C";
            }
                break;
            case 6:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E8%89%BA%E4%BA%BA%7C%E6%98%8E%E6%98%9F";
                
            }
                break;
                
            case 7:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E6%80%80%E6%97%A7%7C%E7%BB%8F%E5%85%B8";
            }
                break;
            case 8:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E7%94%B5%E5%BD%B1%7C%E5%8E%9F%E5%A3%B0";
            }
                break;
                
            case 9:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%8A%A8%E6%BC%AB%7C%E6%B8%B8%E6%88%8F";
            }
                break;
            case 10:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E4%BD%9B%E6%95%99%7C%E7%A6%85%E9%9F%B3";
                
            }
                break;
            case 11:
            {
                
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%82%AC%E7%9C%A0%7C%E8%A7%A3%E5%8E%8B";
                
            }
                break;
            case 12:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%84%BF%E7%AB%A5%7C%E8%83%8E%E6%95%99";
                
            }
                break;
            case 13:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%8D%8E%E8%AF%AD%7C%E7%B2%A4%E8%AF%AD";
                
            }
                break;
            case 14:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E6%97%A5%E8%AF%AD%7C%E9%9F%A9%E8%AF%AD";
            }
                break;
            case 15:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E6%AC%A7%E7%BE%8E%7C%E5%85%B6%E4%BB%96";
                
                
            }
                break;
            case 16:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%99%A8%E4%B9%90%7C%E5%BC%B9%E5%A5%8F";
                
            }
                break;
            case 17:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E7%9D%A1%E5%89%8D.%E5%AE%89%E9%9D%99";
                
            }
                break;
            case 18:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%AD%A4%E5%8D%95.%E4%BC%A4%E6%84%9F";
                
            }
                break;
            case 19:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%E5%8D%88%E5%90%8E.%E5%92%96%E5%95%A1";
                
            }
                break;
            case 20:
            {
                _musicVC.urlStr = @"http://mobile.ximalaya.com/mobile/discovery/v1/category/album?calcDimension=hot&categoryId=2&device=iPhone&pageId=1&pageSize=20&status=0&tagName=%7C%E7%BA%AF%E9%9F%B3%E4%B9%90%7C";
                
            }
                break;
                
                
                
        }
        [_pageViews addObject:_musicVC.view];

        
    }
    return _pageViews;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
